/******************************
 * @Developer: many
 * @File: settime_windows.go
 * @Time: 2022/4/28 9:16
******************************/

package lib

import (
	"os/exec"
	"time"
)

func UpdateSystemDateTime(t *time.Time) error {

	tm := t.Format("15:04:05")
	if err := exec.Command("cmd", "/c", "time", tm).Run(); err != nil {
		return err
	}

	td := t.Format("2006-01-02")
	if err := exec.Command("cmd", "/c", "date", td).Run(); err != nil {
		return err
	}

	return nil
}
